﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using BLL;
using Models;

namespace Workflow.Project
{
    public partial class Log : System.Web.UI.Page
    {
        private PJLogManager objPJLogManager = new PJLogManager();
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void BtnSubmit1_Click(object sender, EventArgs e)
        {
            PJLog objPJLog = new PJLog
            {
                PJId = txtPJNo.Text.Trim().ToUpper(),
                LogContent = txtLogContent.Text.Trim(),
                Stage = ddlStage.SelectedValue,
                Statues = ddlStatues.SelectedValue,
                Person = txtPerson.Text.Trim(),
                Creater = Session["Fullname"].ToString()
            };
            objPJLog.CompleteDate = Request.Params.Get("txtCompleteDate") == "" ? Convert.ToDateTime("1900-01-01") : Convert.ToDateTime(Request.Params.Get("txtCompleteDate"));
            try
            {
                objPJLogManager.InsertLog(objPJLog);
                string msg = string.Format("<script>alert('保存成功！')</script>");
                string str = string.Format("<script>window.close();</script>");
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", msg);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "", str);
            }
            catch (Exception ex)
            {
                string msg = string.Format("<script>alert('{0}')</script>", ex.Message);
                Page.ClientScript.RegisterStartupScript(Page.GetType(), "alert", msg);
            }
        }

    }
}